# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import ValidationError

class Emppeo(models.Model):

    _name = 'emp.peo'
    _rec_name = 'cname'

    peo_id = fields.Many2one(comodel_name='emp.peo')
    jobhist_ids = fields.One2many(string='經歷',comodel_name='emp.jobhist', inverse_name='peo_id')
    leave_batch_ids = fields.One2many(comodel_name='emp.leavebatch', inverse_name='peo_id')
    overtime_ids = fields.One2many(comodel_name='emp.overtime', inverse_name='peo_id')
    calenderpeo_ids = fields.One2many(string='個人行事曆',comodel_name='emp.calenderpeo', inverse_name='peo_id')
    checktime_ids = fields.One2many(comodel_name='emp.checktime', inverse_name='peo_id')
    annual_ids = fields.One2many(comodel_name='emp.annual', inverse_name='peo_id')
    depkind_id = fields.Many2one(string='部別', comodel_name='emp.codedepkind')


    pautono = fields.Char('人員自動編號')
    autono = fields.Char('電腦自動編號')
    pno = fields.Char('職員編號') #自動編號 學年+4碼
    cname = fields.Char('姓名(中文)')
    ename = fields.Char('英文姓名')
    idno = fields.Char('身份證字號')
    passnum = fields.Char('護照字號')
    grnum = fields.Char('居留證號碼')
    sex = fields.Many2one(string='性別',comodel_name='emp.code')
    marry = fields.Many2one(string='婚姻',comodel_name='emp.code')
    birthday = fields.Datetime('生日')
    pea1 = fields.Char('籍貫代碼')
    pea2 = fields.Char('籍貫名稱')
    pea3 = fields.Char('出生地')
    addrnum1 = fields.Char('郵遞區號(戶籍)')
    addr1 = fields.Char('戶籍地址')
    addrnum2 = fields.Char('郵遞區號(通訊)')
    addr2 = fields.Char('通訊地址')
    email = fields.Char('電子郵件')
    country = fields.Many2one(string='國籍',comodel_name='emp.code',default=5250)
    tel1 = fields.Char('戶籍電話')
    tel2 = fields.Char('聯絡電話')
    tel3 = fields.Char('手機')
    teapro = fields.Char('專長類別')
    teaproname = fields.Char('專長名稱')
    ctname = fields.Char('緊急聯絡人 - 姓名')
    ctage = fields.Char('緊急聯絡人 - 關係')
    cttel = fields.Char('緊急聯絡人 - 電話')
    ctaddr = fields.Char('緊急聯絡人 - 地址')
    jobinday = fields.Datetime('行政現職日期')
    yearday = fields.Integer('刷卡起算日')
    outday = fields.Datetime('離校日期')
    jobkind = fields.Many2one(string='職務別',comodel_name='emp.code')
    depkind = fields.Many2one(string='部別',comodel_name='emp.codedepkind')
    depno = fields.Many2one(string='一級單位',comodel_name='emp.codedep')
    admin = fields.Many2one(string='主管別',comodel_name='emp.code')
    jobno = fields.Many2one(string='職稱/行政職稱',comodel_name='emp.code')
    newday = fields.Datetime('資料建立日期')
    lastday = fields.Datetime('最近一次更新日期')
    jobnum = fields.Char('教師證號')
    bsalpt = fields.Integer('原支薪點')
    salpt =  fields.Integer('現支薪點')
    degreelev = fields.Many2one(string='教育程度',comodel_name='emp.code')
    degree = fields.Many2one(string='學位',comodel_name='emp.code')
    memo = fields.Text('備註')
    inday = fields.Datetime('到校日期')
    isthgroup = fields.Char('是否加入省教育會') # maybe Selection
    newuser = fields.Char('資料建立者')
    lastuser = fields.Char('最後修改者')
    status = fields.Many2one(string='目前狀態',comodel_name='emp.code')
    thday = fields.Datetime('入會日期')
    isusecard = fields.Many2one(string='是否打卡',comodel_name='emp.code')
    fulltime = fields.Many2one(string='專兼任',comodel_name='emp.code')
    del_flag = fields.Char('刪除註記')
    depno_sub = fields.Many2one(string='二級單位',comodel_name='emp.codedep')
    campus = fields.Char('校區') # ???
    height = fields.Float('身高')
    weight = fields.Float('體重')
    blood = fields.Many2one(string='血型',comodel_name='emp.code')
    invalidism = fields.Many2one(string='殘障別',comodel_name='emp.code')
    native = fields.Many2one(string='原住民別',comodel_name='emp.code')
    addr3 = fields.Many2one(string='使用校舍',comodel_name='emp.code')
    docsday = fields.Datetime('聘用起日')
    doceday = fields.Datetime('聘用迄日')
    doccalyear = fields.Char('復職日期') # maybe Selection
    addepkind = fields.Many2one(string='部別',comodel_name='emp.codedepkind')
    addepgroup = fields.Many2one(string='學院別',comodel_name='emp.code')
    addepno = fields.Char('任教單位') # 沒有關聯 但看起來是從某個地方抓學系名稱存入
    adjobkind = fields.Many2one(string='職務別',comodel_name='emp.code')
    adjobno = fields.Many2one(string='職稱',comodel_name='emp.code')
    doccalday = fields.Datetime('復職日期')
    formersch = fields.Char('原任單位')
    newsch = fields.Char('新任單位')
    flag = fields.Char('資料匯入註記')
    adminunit = fields.Many2one(string='主要單位',comodel_name='emp.code')
    jobnumday = fields.Datetime('起資日期')
    jobno2 = fields.Char('附加職稱')
    printname = fields.Char('列印職稱')
    printname2 = fields.Char('列印行政兼職職稱')
    printdegree = fields.Char('列印學歷')
    printexp = fields.Char('列印經歷')
    printname3 = fields.Char('列印所屬單位')
    printname4 = fields.Char('共聘系所')
    selfintro = fields.Text('簡要自述')
    shyear = fields.Char('資料學年度')
    gen_dep = fields.Char('通識歸屬系所') #要做關聯 要去佛光正式機看看
    isorganize = fields.Many2one(string='是否為編制內人員',comodel_name='emp.code')
    docnum = fields.Char('聘書字號') # Selection
    suspenday = fields.Datetime('停職日期')
    examresult = fields.Char('審定情形') # Selection
    fpjobkind = fields.Char('專(兼)職業別')
    fpjobname = fields.Char('專(兼)職務')
    isloan = fields.Many2one(string='借調否',comodel_name='emp.code')
    loanfrom = fields.Many2one(string='借調目的(來源)',comodel_name='emp.code')
    loandepname = fields.Char(string='借調新(原)單位')
    istownthgroup = fields.Char('是否加入鄉教育會')
    joblev = fields.Char('職等')
    tempcardnum = fields.Char('臨時卡號')
    realcardnum = fields.Char('實際卡號')
    tjobinday = fields.Datetime('教學現職日期')
    issuetype = fields.Char('')
    isissue = fields.Char('')
    examissueday = fields.Datetime('審定合格日期')
    accdep = fields.Char('技專單位')
    godocsday = fields.Datetime('聘用起日')
    godoceday = fields.Datetime('聘用迄日')
    godoccalyear = fields.Many2one(string='行政聘用期別',comodel_name='emp.code')
    godocnum = fields.Char('聘書字號')
    tel4 = fields.Char('校內分機')
    isbulletin = fields.Char('是否通報')
    istosalary = fields.Char('是否產生至薪資')
    goday = fields.Char('行政人員用雲科到校日')
    rstatus = fields.Many2one(string='雲科狀態',comodel_name='emp.code')
    card_idno = fields.Char('')
    medical_records = fields.Char('')
    docnum_oth = fields.Char('')
    shother_yn = fields.Char('')
    hassal = fields.Char('')
    salresult = fields.Char()
    isfristfap = fields.Char()
    part_issuset = fields.Char()
    issuset_yn = fields.Char('是否領有年金(退休)給付')
    issuset_unit = fields.Char('投保單位')
    web_userid = fields.Char()
    peokind = fields.Char('休假天數人員類別設定')
    fpjobsday = fields.Datetime('專(兼)到職日期')
    issu_retire = fields.Char()
    bank_no = fields.Char()
    bank_acc = fields.Char()
    fpdepname = fields.Char('專(兼)職單位')
    bank_sele = fields.Char()
    projectname = fields.Char()
    sch_pno = fields.Char('學校公號')
    prolev = fields.Char('專業加給職等')
    email_personal = fields.Char('個人EMAIL')
    indaychange = fields.Char('')
    kind1 = fields.Char('')
    isteawonjob = fields.Boolean('兼任教師是否具本（全）職工作者')
    istechvocaedu_no26 = fields.Boolean('是否符合技術及職業教育法第26條適用對象')
